package com.water.bs.service;

import com.water.bs.mapper.UserChangeMapper;
import com.water.bs.pojo.ChangeApply;
import com.water.bs.pojo.ChangeInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserChangeService {
    @Autowired
    private UserChangeMapper userChangeMapper;

    public int makeChange(Map<String,Object> map){
        return userChangeMapper.makeChange(map);
    }

    public List<ChangeInfo> qryMyChange(String id) {
        return userChangeMapper.qryMyChange(id);
    }

    public ChangeInfo getChaneInfoById(String id){
        return userChangeMapper.getChaneInfoById(id);
    }

    public int saveChangeInfoPhoto(Map<String,Object> map){
        return userChangeMapper.saveChangeInfoPhoto(map);
    }

    public int deleteChangeInfo(String id){
        return userChangeMapper.deleteChangeInfo(id);
    }

    public List<Map<String,Object>> qryAllChangeXme(String id){return userChangeMapper.qryAllChangeXme(id);}

    public int makeApplyChange (Map<String,Object> map){return userChangeMapper.makeApplyChange(map);}

    public int updateChangeInfo (Map<String,Object>map){return userChangeMapper.updateChangeInfo(map);}

    public List<Map<String,Object>>qryMyApply(String id){return userChangeMapper.qryMyApply(id);}

    public Map<String,Object>qryMyApply2(String id){return userChangeMapper.qryMyApply2(id);}

    public Map<String,Object>qryMyApply3(String id){return userChangeMapper.qryMyApply3(id);}

    public List<ChangeApply>qryMyRespondent(String id){return userChangeMapper.qryMyRespondent(id);}

    public int cancelMyChangeApply(String changeApplyId){return userChangeMapper.cancelMyChangeApply(changeApplyId);};//用户取消交换

    public int agreeMyChangeRespondent(Map<String,Object>map){return userChangeMapper.agreeMyChangeRespondent(map);};

    public int agreeMyChangeRespondent2(Map<String,Object>map){return userChangeMapper.agreeMyChangeRespondent2(map);};

    public int agreeMyChangeRespondent3(Map<String,Object>map){return userChangeMapper.agreeMyChangeRespondent3(map);};


    public int rejectMyChangeRespondent(Map<String,Object>map){return userChangeMapper.rejectMyChangeRespondent(map);};

    public int saveapplyerexpressid(Map<String,Object>map){return userChangeMapper.saveapplyerexpressid(map);}

    public int saveresponderexpressid(Map<String,Object>map){return userChangeMapper.saveresponderexpressid(map);}

    public int qryIsLike(Map<String,Object>map){return userChangeMapper.qryIsLike(map);}

    public int saveLike (Map<String,Object>map){
        if ((int)map.get("like")>0){
            return userChangeMapper.saveLike(map);
        }else{
            return userChangeMapper.removeLike(map);
        }
    }
    public List<Map<String,Object>> qryMyLike(String id){return userChangeMapper.qryMyLike(id);}

    public List<Map<String,Object>> allChangeHistory(){return userChangeMapper.allChangeHistory();}
}
